package com.entrance.backgroundaction;

import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import android.support.annotation.Nullable;

import com.landmesure.communication.SendMessageThread;

public class BackgroundService extends Service {
    private IBinder mBinder = new RSBinder();


    public class RSBinder extends Binder {
        public BackgroundService getService() {
            return BackgroundService.this;
        }
    }

    private SendMessageThread mSendMessageThread;
    @Nullable
    @Override
    public IBinder onBind(Intent intent) {
        return mBinder;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        startSendMessageThread();
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        return super.onStartCommand(intent, flags, startId);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
    }


    /**
     * 启动发送消息线程(datou)
     */
    private void startSendMessageThread() {
        mSendMessageThread = new SendMessageThread();
        new Thread(mSendMessageThread).start();
    }


}
